import unittest
from time import sleep

from selenium import webdriver
from selenium.webdriver.common.by import By

class Test02(unittest.TestCase):

    def setUp(self) -> None:
        self.driver = webdriver.Chrome()
        self.driver.get("http://192.168.46.5:14753/login")
        self.driver.implicitly_wait(30)
        self.driver.maximize_window()
    def tearDown(self) -> None:
        self.driver.quit()

    def test_denglu01(self):
        self.driver.find_element(By.CLASS_NAME,"username").send_keys("XTGLY")
        self.driver.find_element(By.NAME,"password").send_keys("123456")
        self.driver.find_element(By.ID,"signIn").click()

    def test_denglu02(self):
        self.driver.find_element(By.NAME, "username").send_keys("XTGLY")
        self.driver.find_element(By.ID, "password").send_keys("123456")
        self.driver.find_element(By.TAG_NAME, "button").click()
        self.driver.find_element(By.XPATH, "//*[@id='app']/div/div[2]/section/div/div[2]/div[3]/button").click()
        sleep(2)
        self.driver.find_element(By.XPATH,"/html/body/div[2]/div/div[2]/form/div[7]/div/div/div/div/input").send_keys("D:\\test_accept01.png")
        sleep(2)
        self.driver.get_screenshot_as_file("D:\\test_accept02.png")

if __name__ == '__main__':
    unittest.main()
